﻿<UserControl x:Class="Waf.Writer.Presentation.Views.PrintPreviewView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:p="clr-namespace:Waf.Writer.Presentation.Properties"
    xmlns:doc="clr-namespace:System.Windows.Documents;assembly=PresentationUI"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c="clr-namespace:Waf.Writer.Presentation.Converters"
    xmlns:vm="clr-namespace:Waf.Writer.Applications.ViewModels;assembly=Waf.Writer.Applications"
    mc:Ignorable="d" d:DataContext="{d:DesignInstance vm:PrintPreviewViewModel}">
    
    <UserControl.Resources>
        <Style TargetType="{x:Type DocumentViewer}">
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="ContextMenu" Value="{DynamicResource {ComponentResourceKey ResourceId=PUIDocumentViewerContextMenu, TypeInTargetAssembly={x:Type doc:PresentationUIStyleResources}}}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DocumentViewer}">
                        <Border Focusable="False" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <Grid Background="{TemplateBinding Background}" KeyboardNavigation.TabNavigation="Local">
                                
                                <ScrollViewer x:Name="PART_ContentHost" IsTabStop="true" TabIndex="1" Focusable="{TemplateBinding Focusable}" CanContentScroll="true" HorizontalScrollBarVisibility="Auto"/>
                                
                                <DockPanel>
                                    <FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right"/>
                                    <Rectangle VerticalAlignment="top" Height="10" Visibility="Visible">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                <LinearGradientBrush.GradientStops>
                                                    <GradientStopCollection>
                                                        <GradientStop Color="#66000000" Offset="0"/>
                                                        <GradientStop Color="Transparent" Offset="1"/>
                                                    </GradientStopCollection>
                                                </LinearGradientBrush.GradientStops>
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                </DockPanel>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    
    <DockPanel>
        <DocumentViewer x:Name="documentViewer" Document="{Binding Document}" Zoom="{Binding Zoom, Converter={StaticResource DoubleToZoomConverter}}"/>
    </DockPanel>
    
</UserControl>